﻿<UserControl 
    x:Class="Microsoft.Samples.WindowsPhoneCloud.Phone.PivotContent.SampleDataTablePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DataContext="{d:DesignData ../DesignData/SampleDataTablePageViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="768" d:DesignWidth="480">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <ListBox Grid.Row="0" Margin="12,0,12,12" HorizontalAlignment="Left" ItemsSource="{Binding Table}" VerticalAlignment="Top" Width="455" Height="600" SelectionChanged="OnSelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="0,0,0,15">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="104"/>
                                <ColumnDefinition Width="200"/>
                                <ColumnDefinition Width="40"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="{Binding Name}" Margin="0,0,7,0" TextWrapping="Wrap" />
                            <TextBlock Grid.Column="1" Text="{Binding Description}" Margin="0,0,7,0" TextWrapping="Wrap" />
                            <TextBlock Grid.Column="2" Text="{Binding Number}" Margin="0,0,7,0" TextWrapping="Wrap" />
                            <TextBlock Grid.Column="3" Text="{Binding Date, Converter={StaticResource DateConverter}}" Margin="0,0,7,0" TextWrapping="Wrap" />
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <StackPanel Grid.Row="1" Margin="12,0,12,12" Orientation="Vertical" VerticalAlignment="Bottom">
                <TextBlock Text="{Binding Message}" HorizontalAlignment="Left" TextWrapping="Wrap" />
                <ProgressBar Height="20" IsIndeterminate="True" Visibility="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}" />
            </StackPanel>
        </Grid>
    </Grid>

</UserControl>
